LM ADD CUSTOM POINT LIGHT

This command is similar to 'LM Add Point Light' in that it adds a light that shines equally in all directions, imagine a ball of light, that can be positioned anywhere in the scene.

  Syntax
LM Add Custom Point Light PosX#, PosY#, PosZ#, Radius#, Zero Range#, Attenuation#, Red#, Green#, Blue# 

  Parameters

PosX#
The X position you want the light to be placed.

PosY#
The Y position you want the light to be placed.

PosZ#
The Z position you want the light to be placed.

Radius#
The maximum distance from the light position that the light can effect objects.

Zero Range#
The distance from the light's position at which the light's brightness decreases to 0.

Attenuation#
The speed at which the light fades with distance, higher values fade faster.

Red#
The red component of the light's colour, 0.0-1.0

Green#
The green component of the light's colour, 0.0-1.0

Blue#
The blue component of the light's colour, 0.0-1.0

  Returns

This command does not return a value.

  Description

The difference with this command is that it allows you to control the attenuation of the light and the light's zero range, this is an example of what the default attenuation looks like:



It contains a quadratic term that fades the light quickly as happens in real life, this can be controlled by setting the Attenuation# parameter, the default value is 16.0/(radius*radius). Setting this higher will make the light fade more quickly. Setting it to zero will result in a light that does not fade quadratically over distance:



The light now only fades only as a result of the Zero Range# parameter, which fades the light brightness linearly over distance. The default value for this is the radius so that the light blends in nicely with the scene. Lowering this value results in the light reaching zero intensity before the light's radius. Raising this value results in the light being cut off at the radius before reaching zero intensity creating a sharp transition at the edge of the light's radius between light and dark:



Setting the Zero Range to 0 will disable it and set the light to never fade. It will maintain full intensity all the way to the radius. The light colour is set using the three colour values red, green and blue, and are set as floats between 0.0 for no colour to 1.0 for full colour. This is similar to the DarkBasic RGB() command where 0 is no colour and 255 is full colour. Therefore, in this case 0,0,0 is black, 1,1,1 is white, and 0.2,0,0 is dark red. The colour values can be set above 1.0 to create a light that 'washes out' nearby objects, or below 0.0 to create a shadow light that removes light from areas it affects. The final lightmap colour will be limited to 0.0-1.0